<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="/static/css/index.css" />
  <script type="text/javascript" src="/static/js/index.js"></script>
  <title>医院管理系统 - 登录</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>

<body>
  <div class="container">
    <div class="login-container">
      <div class="login-header">
        <img src="/static/pictures/hospital.png" alt="Hospital Logo" class="logo">
        <h1>中心医院管理系统</h1>
        <p class="subtitle">Central Hospital Management System</p>
      </div>

      {% if current_user.is_authenticated %}
      <div class="user-info">
        <div class="user-avatar">
          <i class="fas fa-user-md"></i>
        </div>
        <div class="user-details">
          <h2>{{ current_user.doctor_name }}</h2>
          <p class="user-id">工号：{{ current_user.doctor_id }}</p>
          <p class="user-dept">{{ current_user.dept_name }}</p>
        </div>
        <div class="logout-section">
          <p>您已登录，是否要退出当前账号？</p>
          <button onclick="logout()" class="logout-btn">
            <i class="fas fa-sign-out-alt"></i> 退出登录
          </button>
          <button onclick="window.location.href='/'" class="return-btn">
            <i class="fas fa-home"></i> 返回首页
          </button>
        </div>
      </div>
      {% else %}
      <div class="login-form">
        <div class="input-group">
          <i class="fas fa-user"></i>
          <input type="text" id="account-InputBlank" placeholder="请输入工号">
        </div>
        <div class="input-group">
          <i class="fas fa-lock"></i>
          <input type="password" id="password-InputBlank" placeholder="请输入密码">
        </div>
        <button onclick="login_submit()" class="login-btn">登录</button>
      </div>
      {% endif %}
    </div>

    <!-- 错误提示模态框 -->
    <div id="alert" class="modal">
      <div class="modal-content">
        <span id="error_information"></span>
        <button onclick="removeAlert()" class="close-btn">确定</button>
      </div>
    </div>
  </div>

  <script src="/static/js/index.js"></script>
</body>

</html>